//
//  GHHomeCollectionViewFlowLayout.swift
//  Browser
//
//  Created by 刘光华 on 16/4/27.
//  Copyright © 2016年 liuguanghua. All rights reserved.
//

import UIKit

class GHHomeCollectionViewFlowLayout: UICollectionViewFlowLayout {

    override func prepareLayout() {
        
        // 定义常量
        let margin: CGFloat = 9
        let col: CGFloat = 3
        
        // cell宽度
        let itemWH = (UIScreen.mainScreen().bounds.size.width - (col + 1) * margin) / col
        
        // 布局内容
        itemSize = CGSize(width: itemWH, height: itemWH)
        minimumInteritemSpacing = margin
        minimumLineSpacing = margin
        
        // 内边距
        collectionView?.contentInset = UIEdgeInsets(top: margin + 64, left: margin, bottom: margin, right: margin)
        
        
    }
    
    
}
